namespace SmartSoft.Lists
{
    using SmartSoft;
    using SmartSoft.Controls;
    using SmartSoft.Controls.ChildGridControls;
    using SmartSoft.Properties;
    using SmartSoft.ADP;
    using System;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Windows.Forms;
    using NLog;
    using Integrator.DAL;
    using System.Threading;

    public class FormDmTsEditor : FormListEditor
    {
        private static Logger log = LogManager.GetCurrentClassLogger();

        #region Properties
        private SearchColumn Column1;
        private DataGridViewTextBoxColumn Column2;
        private SearchColumn Column3;
        private NumericColumn Column4;
        private NumericColumn Column5;
        private NumericColumn Column6;
        private NumericColumn Column7;
        private IContainer components;
        private GridDetail grdDetail;
        private bool ib_PictureChanged;
        private string is_FixedAssetType = "C";
        private string is_PicturePath;
        private LabelControl lblCong_Suat;
        private LabelControl lblDesc_EN;
        private LabelControl lblDien_Giai;
        private LabelControl lblDvt;
        private LabelControl lblMa_Bp;
        private LabelControl lblMa_MDSD;
        private LabelControl lblMa_Nh_Ts;
        private LabelControl lblMa_Ts;
        private LabelControl lblNam_Sx;
        private LabelControl lblNgay_KH;
        private LabelControl lblNgay_Ts;
        private LabelControl lblNuoc_Sx;
        private LabelControl lblSo_Ct_T;
        private LabelControl lblSo_Hieu;
        private LabelControl lblSo_Luong;
        private LabelControl lblSo_Thang;
        private LabelControl lblTen_Ts;
        private LabelControl lblTen_Ts_E;
        private LabelControl lblThe_Ts;
        private LabelControl lblTinh_KH;
        private LabelControl lblTinh_KH0;
        private LabelControl lblTk;
        private LabelControl lblTk_Co;
        private LabelControl lblTk_No;
        private LabelControl lblTTien0;
        private LabelControl lblTTien1;
        private LabelControl lblTTien2;
        private LabelControl lblTTien3;
        private DataTable oDetailTable;
        private DataRow oMasterRow;
        private DmTsDataAccess oMethod = new DmTsDataAccess();
        private System.Windows.Forms.PictureBox PictureBox;
        private Panel pnlPicture;
        private TextControl txtCong_Suat;
        private TextControl txtDesc_EN;
        private TextControl txtDien_Giai;
        private TextSearch txtMa_Bp;
        private TextSearch txtMa_MDSD;
        private TextSearch txtMa_Nh_Ts;
        private TextControl txtMa_Ts;
        private TextDate txtNgay_KH;
        private TextDate txtNgay_Ts;
        private TextControl txtSo_Ct_T;
        private TextControl txtSo_Hieu;
        private TextNumeric txtSo_Luong;
        private TextNumeric txtSo_Thang;
        private TextControl txtTen_Ts;
        private TextControl txtTen_Ts_E;
        private TextControl txtThe_Ts;
        private TextOption txtTinh_KH;
        private TextSearch txtTk;
        private TextSearch txtTk_Co;
        private TextSearch txtTk_No;
        private TextNumeric txtTongNguyenGia;
        private TextNumeric txtGiaTriHaoMon;
        private TextNumeric txtKhauHaoThang;
        private TextControl txtTen_Ncc;
        private TextSearch txtMa_Ncc;
        private LabelControl lblMa_Ncc;
        private TextDate txtHan_Bh;
        private LabelControl lblHan_Bh;
        private TextControl txtTen_Nsx;
        private TextSearch txtMa_Nsx;
        private LabelControl lblMa_Nsx;
        private TextControl txtTen_Bp;
        private TextControl txtTen_Nh_Ts;
        private LabelControl lblLoai_Ts;
        private TextOption txtLoai_Ts;
        private LabelControl lblIsLoai_Ts;
        private TextControl txtNuoc_Sx;
        private TextSearch txtMa_Qg;
        private TextControl txtNam_Sx;
        private LabelControl labelControl1;
        private TextDate txtNgay_BDKH;
        private TextSearch txtMa_Dvt;
        private TextControl txtTen_Dvt;
        private TextNumeric txtGiaTriConLai;
        #endregion

        public FormDmTsEditor()
        {
            this.InitializeComponent();
            this.txtMa_Ts.Value = AppInstance.Subsidiary;
            SendKeys.Send("{End}");           
        }

        public FormDmTsEditor(string ps_Loai_Ts)
        {
            is_FixedAssetType = ps_Loai_Ts;
            this.InitializeComponent();
            if (ps_Loai_Ts.Equals("K"))
            {               
                this.Text = "Thêm mới công cụ";
                this.AddTitleText = "Thêm mới công cụ";
                this.EditTitleText = "Sửa công cụ";
                this.lblMa_Ts.Text = "Mã công cụ";
                this.lblTen_Ts.Text = "Tên công cụ";
                this.lblThe_Ts.Text = "Thẻ công cụ";

                this.txtLoai_Ts.ReadOnly = true;
                this.txtLoai_Ts.TabStop = false;

                this.txtTinh_KH.Text = "K";
                
                //this.txtTinh_KH.ReadOnly = true;
                //this.txtTinh_KH.TabStop = false;
                this.txtTinh_KH.Visible = false;
                this.lblTinh_KH.Visible = lblTinh_KH0.Visible = false;

                //this.txtNgay_BDKH.ReadOnly = true;
                //this.txtNgay_BDKH.TabStop = false;
                this.txtNgay_BDKH.Visible = false;

                //this.txtNgay_KH.ReadOnly = true;
                //this.txtNgay_KH.TabStop = false;
                this.txtNgay_KH.Visible = false;

                this.txtSo_Thang.Value = 1;
                
                //this.txtSo_Thang.ReadOnly = true;
                //this.txtSo_Thang.TabStop = false;

                this.txtSo_Thang.Visible = false;
                this.labelControl1.Visible = lblNgay_KH.Visible = lblSo_Thang.Visible = false;
                this.lblTTien1.Visible = lblTTien2.Visible = lblTTien3.Visible = false;                
                this.txtGiaTriHaoMon.Visible = txtGiaTriConLai.Visible = txtKhauHaoThang.Visible = false;
                this.txtTk_Co.Visible = lblTk_Co.Visible = false;
                this.txtTk_No.Visible = lblTk_No.Visible = false;
            }

            this.txtMa_Ts.Value = AppInstance.Subsidiary;
            SendKeys.Send("{End}");
        }

        private bool AddNewRow(bool pb_Inserted)
        {
            if ((this.grdDetail.CurrentRow == null) || (this.grdDetail.CurrentRow.DataBoundItem == null))
            {
                return false;
            }
            if (((decimal) ((DataRowView) this.grdDetail.CurrentRow.DataBoundItem).Row["Tien0"]) == 0M)
            {
                return false;
            }
            if (this.grdDetail.CurrentRow.Index != (this.grdDetail.Rows.Count - 1))
            {
                return false;
            }
            this.grdDetail.EndEdit();
            DataRow row = this.oDetailTable.NewRow();
            row["Stt0"] = SSDataAccess.Cong_So_Tt(AppInstance.Subsidiary);
            row["Tien0"] = 0;
            row["Tien1"] = 0;
            row["Loai_TGTS"] = "T";
            row["Tien3"] = 0;
            row["Tien4"] = 0;
            this.oDetailTable.Rows.Add(row);
            BindingSource dataSource = this.grdDetail.DataSource as BindingSource;
            dataSource.Position = dataSource.Find("Stt0", row["Stt0"]);
            return true;
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void grdDetail_CellBottomLeftLeaved(object sender, EventArgs e)
        {
            if (((this.grdDetail.Rows.Count == 1) || !string.IsNullOrEmpty(((DataRowView) this.grdDetail.CurrentRow.DataBoundItem).Row["Ma_TGTS"].ToString())) || !string.IsNullOrEmpty(base.ActiveControl.Text))
            {
                this.grdDetail.UserMoveNextCell = GridDetail.MoveNextType.NextCell;
            }
            else
            {
                this.txtTinh_KH.Focus();
                this.grdDetail.UserMoveNextCell = GridDetail.MoveNextType.DeleteCurrentRow;
            }
        }

        private void grdDetail_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex >= 3)
            {
                this.Sum();
            }
        }

        private void grdDetail_CellRightLeaved(object sender, EventArgs e)
        {
            if (this.AddNewRow(false))
            {
                this.grdDetail.UserMoveNextCell = GridDetail.MoveNextType.FirstCell;
            }
            else
            {
                this.grdDetail.UserMoveNextCell = GridDetail.MoveNextType.FirstCellNextRow;
            }
        }

        private void InitializeComponent()
        {
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
            this.txtMa_Ts = new SmartSoft.Controls.TextControl();
            this.lblMa_Ts = new SmartSoft.Controls.LabelControl();
            this.txtTen_Ts = new SmartSoft.Controls.TextControl();
            this.lblTen_Ts = new SmartSoft.Controls.LabelControl();
            this.txtTen_Ts_E = new SmartSoft.Controls.TextControl();
            this.lblTen_Ts_E = new SmartSoft.Controls.LabelControl();
            this.lblDvt = new SmartSoft.Controls.LabelControl();
            this.lblTk = new SmartSoft.Controls.LabelControl();
            this.txtTk = new SmartSoft.Controls.TextSearch();
            this.lblMa_Nh_Ts = new SmartSoft.Controls.LabelControl();
            this.txtMa_Nh_Ts = new SmartSoft.Controls.TextSearch();
            this.txtTen_Nh_Ts = new SmartSoft.Controls.TextControl();
            this.lblMa_MDSD = new SmartSoft.Controls.LabelControl();
            this.txtMa_MDSD = new SmartSoft.Controls.TextSearch();
            this.lblMa_Bp = new SmartSoft.Controls.LabelControl();
            this.txtMa_Bp = new SmartSoft.Controls.TextSearch();
            this.txtTen_Bp = new SmartSoft.Controls.TextControl();
            this.pnlPicture = new System.Windows.Forms.Panel();
            this.PictureBox = new System.Windows.Forms.PictureBox();
            this.txtThe_Ts = new SmartSoft.Controls.TextControl();
            this.lblThe_Ts = new SmartSoft.Controls.LabelControl();
            this.txtSo_Hieu = new SmartSoft.Controls.TextControl();
            this.lblSo_Hieu = new SmartSoft.Controls.LabelControl();
            this.txtSo_Luong = new SmartSoft.Controls.TextNumeric();
            this.lblSo_Luong = new SmartSoft.Controls.LabelControl();
            this.txtSo_Ct_T = new SmartSoft.Controls.TextControl();
            this.lblSo_Ct_T = new SmartSoft.Controls.LabelControl();
            this.txtNgay_Ts = new SmartSoft.Controls.TextDate();
            this.lblNgay_Ts = new SmartSoft.Controls.LabelControl();
            this.lblNuoc_Sx = new SmartSoft.Controls.LabelControl();
            this.lblNam_Sx = new SmartSoft.Controls.LabelControl();
            this.txtCong_Suat = new SmartSoft.Controls.TextControl();
            this.lblCong_Suat = new SmartSoft.Controls.LabelControl();
            this.grdDetail = new SmartSoft.Controls.GridDetail();
            this.Column1 = new SmartSoft.Controls.ChildGridControls.SearchColumn();
            this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column3 = new SmartSoft.Controls.ChildGridControls.SearchColumn();
            this.Column4 = new SmartSoft.Controls.ChildGridControls.NumericColumn();
            this.Column5 = new SmartSoft.Controls.ChildGridControls.NumericColumn();
            this.Column6 = new SmartSoft.Controls.ChildGridControls.NumericColumn();
            this.Column7 = new SmartSoft.Controls.ChildGridControls.NumericColumn();
            this.txtDien_Giai = new SmartSoft.Controls.TextControl();
            this.txtDesc_EN = new SmartSoft.Controls.TextControl();
            this.lblDien_Giai = new SmartSoft.Controls.LabelControl();
            this.lblDesc_EN = new SmartSoft.Controls.LabelControl();
            this.txtTinh_KH = new SmartSoft.Controls.TextOption();
            this.lblTinh_KH = new SmartSoft.Controls.LabelControl();
            this.lblTinh_KH0 = new SmartSoft.Controls.LabelControl();
            this.lblTTien2 = new SmartSoft.Controls.LabelControl();
            this.txtKhauHaoThang = new SmartSoft.Controls.TextNumeric();
            this.lblTTien3 = new SmartSoft.Controls.LabelControl();
            this.txtGiaTriConLai = new SmartSoft.Controls.TextNumeric();
            this.lblTTien1 = new SmartSoft.Controls.LabelControl();
            this.txtGiaTriHaoMon = new SmartSoft.Controls.TextNumeric();
            this.lblTTien0 = new SmartSoft.Controls.LabelControl();
            this.txtTongNguyenGia = new SmartSoft.Controls.TextNumeric();
            this.lblNgay_KH = new SmartSoft.Controls.LabelControl();
            this.txtNgay_KH = new SmartSoft.Controls.TextDate();
            this.lblSo_Thang = new SmartSoft.Controls.LabelControl();
            this.txtSo_Thang = new SmartSoft.Controls.TextNumeric();
            this.lblTk_Co = new SmartSoft.Controls.LabelControl();
            this.lblTk_No = new SmartSoft.Controls.LabelControl();
            this.txtTk_Co = new SmartSoft.Controls.TextSearch();
            this.txtTk_No = new SmartSoft.Controls.TextSearch();
            this.txtTen_Ncc = new SmartSoft.Controls.TextControl();
            this.txtMa_Ncc = new SmartSoft.Controls.TextSearch();
            this.lblMa_Ncc = new SmartSoft.Controls.LabelControl();
            this.txtHan_Bh = new SmartSoft.Controls.TextDate();
            this.lblHan_Bh = new SmartSoft.Controls.LabelControl();
            this.txtTen_Nsx = new SmartSoft.Controls.TextControl();
            this.txtMa_Nsx = new SmartSoft.Controls.TextSearch();
            this.lblMa_Nsx = new SmartSoft.Controls.LabelControl();
            this.lblLoai_Ts = new SmartSoft.Controls.LabelControl();
            this.txtLoai_Ts = new SmartSoft.Controls.TextOption();
            this.lblIsLoai_Ts = new SmartSoft.Controls.LabelControl();
            this.txtNuoc_Sx = new SmartSoft.Controls.TextControl();
            this.txtMa_Qg = new SmartSoft.Controls.TextSearch();
            this.txtNam_Sx = new SmartSoft.Controls.TextControl();
            this.labelControl1 = new SmartSoft.Controls.LabelControl();
            this.txtNgay_BDKH = new SmartSoft.Controls.TextDate();
            this.txtMa_Dvt = new SmartSoft.Controls.TextSearch();
            this.txtTen_Dvt = new SmartSoft.Controls.TextControl();
            ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
            this.pnlPicture.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.PictureBox)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.grdDetail)).BeginInit();
            this.SuspendLayout();
            // 
            // lblPhan_Loai
            // 
            this.lblPhan_Loai.Location = new System.Drawing.Point(12, 505);
            // 
            // txtMa_Loai1
            // 
            this.txtMa_Loai1.FirstFilter = "Type = \'TS1\'";
            this.txtMa_Loai1.Location = new System.Drawing.Point(123, 502);
            this.txtMa_Loai1.Size = new System.Drawing.Size(219, 20);
            // 
            // txtMa_Loai2
            // 
            this.txtMa_Loai2.FirstFilter = "Type = \'TS2\'";
            this.txtMa_Loai2.Location = new System.Drawing.Point(343, 502);
            this.txtMa_Loai2.Size = new System.Drawing.Size(221, 20);
            // 
            // txtMa_Loai3
            // 
            this.txtMa_Loai3.FirstFilter = "Type = \'TS3\'";
            this.txtMa_Loai3.Location = new System.Drawing.Point(565, 502);
            this.txtMa_Loai3.Size = new System.Drawing.Size(219, 20);
            // 
            // txtMa_Ts
            // 
            this.txtMa_Ts.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtMa_Ts.CheckTextSearched = false;
            this.txtMa_Ts.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtMa_Ts.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtMa_Ts.Location = new System.Drawing.Point(123, 28);
            this.txtMa_Ts.MaxLength = 32;
            this.txtMa_Ts.Name = "txtMa_Ts";
            this.txtMa_Ts.OldValue = null;
            this.txtMa_Ts.Size = new System.Drawing.Size(119, 20);
            this.txtMa_Ts.TabIndex = 0;
            this.txtMa_Ts.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemCode;
            this.txtMa_Ts.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.All;
            this.txtMa_Ts.Value = string.Empty;
            // 
            // lblMa_Ts
            // 
            this.lblMa_Ts.AutoSize = true;
            this.lblMa_Ts.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblMa_Ts.Location = new System.Drawing.Point(12, 31);
            this.lblMa_Ts.Name = "lblMa_Ts";
            this.lblMa_Ts.Size = new System.Drawing.Size(56, 14);
            this.lblMa_Ts.TabIndex = 4;
            this.lblMa_Ts.Text = "Mã tài sản";
            // 
            // txtTen_Ts
            // 
            this.txtTen_Ts.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTen_Ts.CheckTextSearched = false;
            this.txtTen_Ts.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtTen_Ts.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_Ts.Location = new System.Drawing.Point(123, 49);
            this.txtTen_Ts.MaxLength = 128;
            this.txtTen_Ts.Name = "txtTen_Ts";
            this.txtTen_Ts.OldValue = null;
            this.txtTen_Ts.Size = new System.Drawing.Size(428, 20);
            this.txtTen_Ts.TabIndex = 3;
            this.txtTen_Ts.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemDescription;
            this.txtTen_Ts.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.All;
            this.txtTen_Ts.Value = string.Empty;
            // 
            // lblTen_Ts
            // 
            this.lblTen_Ts.AutoSize = true;
            this.lblTen_Ts.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblTen_Ts.Location = new System.Drawing.Point(12, 52);
            this.lblTen_Ts.Name = "lblTen_Ts";
            this.lblTen_Ts.Size = new System.Drawing.Size(60, 14);
            this.lblTen_Ts.TabIndex = 4;
            this.lblTen_Ts.Text = "Tên tài sản";
            // 
            // txtTen_Ts_E
            // 
            this.txtTen_Ts_E.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTen_Ts_E.CheckTextSearched = false;
            this.txtTen_Ts_E.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtTen_Ts_E.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_Ts_E.Location = new System.Drawing.Point(123, 70);
            this.txtTen_Ts_E.MaxLength = 128;
            this.txtTen_Ts_E.Name = "txtTen_Ts_E";
            this.txtTen_Ts_E.OldValue = null;
            this.txtTen_Ts_E.Size = new System.Drawing.Size(428, 20);
            this.txtTen_Ts_E.TabIndex = 4;
            this.txtTen_Ts_E.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemDescription;
            this.txtTen_Ts_E.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.All;
            this.txtTen_Ts_E.Value = string.Empty;
            // 
            // lblTen_Ts_E
            // 
            this.lblTen_Ts_E.AutoSize = true;
            this.lblTen_Ts_E.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblTen_Ts_E.Location = new System.Drawing.Point(12, 73);
            this.lblTen_Ts_E.Name = "lblTen_Ts_E";
            this.lblTen_Ts_E.Size = new System.Drawing.Size(73, 14);
            this.lblTen_Ts_E.TabIndex = 4;
            this.lblTen_Ts_E.Text = "Tên tiếng Anh";
            // 
            // lblDvt
            // 
            this.lblDvt.AutoSize = true;
            this.lblDvt.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblDvt.Location = new System.Drawing.Point(12, 94);
            this.lblDvt.Name = "lblDvt";
            this.lblDvt.Size = new System.Drawing.Size(59, 14);
            this.lblDvt.TabIndex = 4;
            this.lblDvt.Text = "Đơn vị tính";
            // 
            // lblTk
            // 
            this.lblTk.AutoSize = true;
            this.lblTk.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblTk.Location = new System.Drawing.Point(12, 223);
            this.lblTk.Name = "lblTk";
            this.lblTk.Size = new System.Drawing.Size(53, 14);
            this.lblTk.TabIndex = 4;
            this.lblTk.Text = "Tài khoản";
            this.lblTk.Click += new System.EventHandler(this.lblTk_Click);
            // 
            // txtTk
            // 
            this.txtTk.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtTk.CheckTextSearched = false;
            this.txtTk.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtTk.FirstFilter = "Loai_Tk = \'C\'";
            this.txtTk.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTk.Location = new System.Drawing.Point(123, 219);
            this.txtTk.MaxLength = 32;
            this.txtTk.Name = "txtTk";
            this.txtTk.OldValue = null;
            this.txtTk.Size = new System.Drawing.Size(100, 20);
            this.txtTk.TabIndex = 17;
            this.txtTk.TableName = "DMTK";
            this.txtTk.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemCode;
            this.txtTk.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.All;
            this.txtTk.TextChanged += new System.EventHandler(this.txtTk_TextChanged);
            // 
            // lblMa_Nh_Ts
            // 
            this.lblMa_Nh_Ts.AutoSize = true;
            this.lblMa_Nh_Ts.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblMa_Nh_Ts.Location = new System.Drawing.Point(411, 222);
            this.lblMa_Nh_Ts.Name = "lblMa_Nh_Ts";
            this.lblMa_Nh_Ts.Size = new System.Drawing.Size(34, 14);
            this.lblMa_Nh_Ts.TabIndex = 4;
            this.lblMa_Nh_Ts.Text = "Nhóm";
            // 
            // txtMa_Nh_Ts
            // 
            this.txtMa_Nh_Ts.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtMa_Nh_Ts.CheckTextSearched = false;
            this.txtMa_Nh_Ts.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtMa_Nh_Ts.FirstFilter = "Nh_Cuoi_Ts = \'C\'";
            this.txtMa_Nh_Ts.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtMa_Nh_Ts.Location = new System.Drawing.Point(451, 219);
            this.txtMa_Nh_Ts.MaxLength = 32;
            this.txtMa_Nh_Ts.Name = "txtMa_Nh_Ts";
            this.txtMa_Nh_Ts.OldValue = null;
            this.txtMa_Nh_Ts.Size = new System.Drawing.Size(100, 20);
            this.txtMa_Nh_Ts.TabIndex = 19;
            this.txtMa_Nh_Ts.TableName = "DMNHTS";
            this.txtMa_Nh_Ts.TextDisplay = this.txtTen_Nh_Ts;
            this.txtMa_Nh_Ts.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemCode;
            this.txtMa_Nh_Ts.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.All;
            this.txtMa_Nh_Ts.Value = string.Empty;
            // 
            // txtTen_Nh_Ts
            // 
            this.txtTen_Nh_Ts.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTen_Nh_Ts.BackColor = System.Drawing.SystemColors.Control;
            this.txtTen_Nh_Ts.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtTen_Nh_Ts.CheckTextSearched = false;
            this.txtTen_Nh_Ts.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtTen_Nh_Ts.Enabled = false;
            this.txtTen_Nh_Ts.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_Nh_Ts.ForeColor = System.Drawing.Color.Blue;
            this.txtTen_Nh_Ts.Location = new System.Drawing.Point(557, 223);
            this.txtTen_Nh_Ts.Name = "txtTen_Nh_Ts";
            this.txtTen_Nh_Ts.OldValue = null;
            this.txtTen_Nh_Ts.Size = new System.Drawing.Size(227, 13);
            this.txtTen_Nh_Ts.TabIndex = 20;
            this.txtTen_Nh_Ts.UserTextLength = SmartSoft.AppInstance.TextControlLength.None;
            this.txtTen_Nh_Ts.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.Right;
            // 
            // lblMa_MDSD
            // 
            this.lblMa_MDSD.AutoSize = true;
            this.lblMa_MDSD.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblMa_MDSD.Location = new System.Drawing.Point(11, 243);
            this.lblMa_MDSD.Name = "lblMa_MDSD";
            this.lblMa_MDSD.Size = new System.Drawing.Size(93, 14);
            this.lblMa_MDSD.TabIndex = 4;
            this.lblMa_MDSD.Text = "Mục đích sử dụng";
            // 
            // txtMa_MDSD
            // 
            this.txtMa_MDSD.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtMa_MDSD.CheckTextSearched = false;
            this.txtMa_MDSD.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtMa_MDSD.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtMa_MDSD.Location = new System.Drawing.Point(123, 240);
            this.txtMa_MDSD.MaxLength = 32;
            this.txtMa_MDSD.Name = "txtMa_MDSD";
            this.txtMa_MDSD.OldValue = null;
            this.txtMa_MDSD.Size = new System.Drawing.Size(100, 20);
            this.txtMa_MDSD.TabIndex = 21;
            this.txtMa_MDSD.TableName = "DMMDSD";
            this.txtMa_MDSD.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemCode;
            this.txtMa_MDSD.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.All;
            this.txtMa_MDSD.Value = string.Empty;
            // 
            // lblMa_Bp
            // 
            this.lblMa_Bp.AutoSize = true;
            this.lblMa_Bp.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblMa_Bp.Location = new System.Drawing.Point(357, 243);
            this.lblMa_Bp.Name = "lblMa_Bp";
            this.lblMa_Bp.Size = new System.Drawing.Size(90, 14);
            this.lblMa_Bp.TabIndex = 4;
            this.lblMa_Bp.Text = "Bộ phận sử dụng";
            // 
            // txtMa_Bp
            // 
            this.txtMa_Bp.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtMa_Bp.CheckTextSearched = false;
            this.txtMa_Bp.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtMa_Bp.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtMa_Bp.Location = new System.Drawing.Point(451, 240);
            this.txtMa_Bp.MaxLength = 32;
            this.txtMa_Bp.Name = "txtMa_Bp";
            this.txtMa_Bp.OldValue = null;
            this.txtMa_Bp.Size = new System.Drawing.Size(100, 20);
            this.txtMa_Bp.TabIndex = 22;
            this.txtMa_Bp.TableName = "DMBP";
            this.txtMa_Bp.TextDisplay = this.txtTen_Bp;
            this.txtMa_Bp.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemCode;
            this.txtMa_Bp.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.All;
            this.txtMa_Bp.Value = string.Empty;
            // 
            // txtTen_Bp
            // 
            this.txtTen_Bp.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTen_Bp.BackColor = System.Drawing.SystemColors.Control;
            this.txtTen_Bp.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtTen_Bp.CheckTextSearched = false;
            this.txtTen_Bp.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtTen_Bp.Enabled = false;
            this.txtTen_Bp.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_Bp.ForeColor = System.Drawing.Color.Blue;
            this.txtTen_Bp.Location = new System.Drawing.Point(557, 244);
            this.txtTen_Bp.Name = "txtTen_Bp";
            this.txtTen_Bp.OldValue = null;
            this.txtTen_Bp.Size = new System.Drawing.Size(227, 13);
            this.txtTen_Bp.TabIndex = 23;
            this.txtTen_Bp.UserTextLength = SmartSoft.AppInstance.TextControlLength.None;
            this.txtTen_Bp.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.Right;
            this.txtTen_Bp.Value = string.Empty;
            // 
            // pnlPicture
            // 
            this.pnlPicture.BackColor = System.Drawing.Color.LimeGreen;
            this.pnlPicture.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            this.pnlPicture.Controls.Add(this.PictureBox);
            this.pnlPicture.Location = new System.Drawing.Point(557, 28);
            this.pnlPicture.Name = "pnlPicture";
            this.pnlPicture.Size = new System.Drawing.Size(227, 193);
            this.pnlPicture.TabIndex = 5;
            // 
            // PictureBox
            // 
            this.PictureBox.BackgroundImage = global::SmartSoft.Properties.Resources.NoPicture;
            this.PictureBox.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
            this.PictureBox.Location = new System.Drawing.Point(3, 3);
            this.PictureBox.Name = "PictureBox";
            this.PictureBox.Size = new System.Drawing.Size(217, 183);
            this.PictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.PictureBox.TabIndex = 0;
            this.PictureBox.TabStop = false;
            this.PictureBox.DoubleClick += new System.EventHandler(this.PictureBox_DoubleClick);
            // 
            // txtThe_Ts
            // 
            this.txtThe_Ts.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtThe_Ts.CheckTextSearched = false;
            this.txtThe_Ts.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtThe_Ts.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtThe_Ts.Location = new System.Drawing.Point(310, 28);
            this.txtThe_Ts.MaxLength = 32;
            this.txtThe_Ts.Name = "txtThe_Ts";
            this.txtThe_Ts.OldValue = null;
            this.txtThe_Ts.Size = new System.Drawing.Size(95, 20);
            this.txtThe_Ts.TabIndex = 1;
            this.txtThe_Ts.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemCode;
            this.txtThe_Ts.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.All;
            this.txtThe_Ts.Value = string.Empty;
            // 
            // lblThe_Ts
            // 
            this.lblThe_Ts.AutoSize = true;
            this.lblThe_Ts.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblThe_Ts.Location = new System.Drawing.Point(242, 31);
            this.lblThe_Ts.Name = "lblThe_Ts";
            this.lblThe_Ts.Size = new System.Drawing.Size(60, 14);
            this.lblThe_Ts.TabIndex = 4;
            this.lblThe_Ts.Text = "Thẻ tài sản";
            // 
            // txtSo_Hieu
            // 
            this.txtSo_Hieu.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtSo_Hieu.CheckTextSearched = false;
            this.txtSo_Hieu.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtSo_Hieu.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtSo_Hieu.Location = new System.Drawing.Point(460, 28);
            this.txtSo_Hieu.MaxLength = 32;
            this.txtSo_Hieu.Name = "txtSo_Hieu";
            this.txtSo_Hieu.OldValue = null;
            this.txtSo_Hieu.Size = new System.Drawing.Size(91, 20);
            this.txtSo_Hieu.TabIndex = 2;
            this.txtSo_Hieu.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemCode;
            this.txtSo_Hieu.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.All;
            this.txtSo_Hieu.Value = string.Empty;
            // 
            // lblSo_Hieu
            // 
            this.lblSo_Hieu.AutoSize = true;
            this.lblSo_Hieu.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblSo_Hieu.Location = new System.Drawing.Point(404, 31);
            this.lblSo_Hieu.Name = "lblSo_Hieu";
            this.lblSo_Hieu.Size = new System.Drawing.Size(50, 14);
            this.lblSo_Hieu.TabIndex = 4;
            this.lblSo_Hieu.Text = "Số Serial";
            // 
            // txtSo_Luong
            // 
            this.txtSo_Luong.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtSo_Luong.Location = new System.Drawing.Point(451, 91);
            this.txtSo_Luong.Name = "txtSo_Luong";
            this.txtSo_Luong.NumericValue = new decimal(new int[] {
            0,
            0,
            0,
            0});
            this.txtSo_Luong.OldValue = null;
            this.txtSo_Luong.Size = new System.Drawing.Size(100, 20);
            this.txtSo_Luong.TabIndex = 6;
            this.txtSo_Luong.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            this.txtSo_Luong.UserTextNumericFormat = SmartSoft.AppInstance.TextNumericFormat.Quantity;            
            // 
            // lblSo_Luong
            // 
            this.lblSo_Luong.AutoSize = true;
            this.lblSo_Luong.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblSo_Luong.Location = new System.Drawing.Point(396, 94);
            this.lblSo_Luong.Name = "lblSo_Luong";
            this.lblSo_Luong.Size = new System.Drawing.Size(51, 14);
            this.lblSo_Luong.TabIndex = 39;
            this.lblSo_Luong.Text = "Số lượng";
            // 
            // txtSo_Ct_T
            // 
            this.txtSo_Ct_T.CheckTextSearched = false;
            this.txtSo_Ct_T.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtSo_Ct_T.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtSo_Ct_T.Location = new System.Drawing.Point(123, 112);
            this.txtSo_Ct_T.MaxLength = 20;
            this.txtSo_Ct_T.Name = "txtSo_Ct_T";
            this.txtSo_Ct_T.OldValue = null;
            this.txtSo_Ct_T.Size = new System.Drawing.Size(100, 20);
            this.txtSo_Ct_T.TabIndex = 7;
            this.txtSo_Ct_T.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemUnit;
            this.txtSo_Ct_T.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.All;
            this.txtSo_Ct_T.Value = string.Empty;
            // 
            // lblSo_Ct_T
            // 
            this.lblSo_Ct_T.AutoSize = true;
            this.lblSo_Ct_T.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblSo_Ct_T.Location = new System.Drawing.Point(12, 115);
            this.lblSo_Ct_T.Name = "lblSo_Ct_T";
            this.lblSo_Ct_T.Size = new System.Drawing.Size(67, 14);
            this.lblSo_Ct_T.TabIndex = 4;
            this.lblSo_Ct_T.Text = "Số chứng từ";
            // 
            // txtNgay_Ts
            // 
            this.txtNgay_Ts.DateTimeFormat = SmartSoft.Controls.TextDate.DateTimeFormatType.Date;
            this.txtNgay_Ts.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtNgay_Ts.InsertKeyMode = System.Windows.Forms.InsertKeyMode.Overwrite;
            this.txtNgay_Ts.Location = new System.Drawing.Point(451, 112);
            this.txtNgay_Ts.Mask = "00/00/0000";
            this.txtNgay_Ts.Name = "txtNgay_Ts";
            this.txtNgay_Ts.OldValue = null;
            this.txtNgay_Ts.Size = new System.Drawing.Size(100, 20);
            this.txtNgay_Ts.TabIndex = 8;            
            // 
            // lblNgay_Ts
            // 
            this.lblNgay_Ts.AutoSize = true;
            this.lblNgay_Ts.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblNgay_Ts.Location = new System.Drawing.Point(391, 115);
            this.lblNgay_Ts.Name = "lblNgay_Ts";
            this.lblNgay_Ts.Size = new System.Drawing.Size(56, 14);
            this.lblNgay_Ts.TabIndex = 39;
            this.lblNgay_Ts.Text = "Ngày tăng";
            // 
            // lblNuoc_Sx
            // 
            this.lblNuoc_Sx.AutoSize = true;
            this.lblNuoc_Sx.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblNuoc_Sx.Location = new System.Drawing.Point(12, 179);
            this.lblNuoc_Sx.Name = "lblNuoc_Sx";
            this.lblNuoc_Sx.Size = new System.Drawing.Size(79, 14);
            this.lblNuoc_Sx.TabIndex = 4;
            this.lblNuoc_Sx.Text = "Nước sản xuất";
            // 
            // lblNam_Sx
            // 
            this.lblNam_Sx.AutoSize = true;
            this.lblNam_Sx.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblNam_Sx.Location = new System.Drawing.Point(374, 179);
            this.lblNam_Sx.Name = "lblNam_Sx";
            this.lblNam_Sx.Size = new System.Drawing.Size(73, 14);
            this.lblNam_Sx.TabIndex = 39;
            this.lblNam_Sx.Text = "Năm sản xuất";
            // 
            // txtCong_Suat
            // 
            this.txtCong_Suat.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtCong_Suat.CheckTextSearched = false;
            this.txtCong_Suat.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtCong_Suat.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtCong_Suat.Location = new System.Drawing.Point(123, 198);
            this.txtCong_Suat.MaxLength = 128;
            this.txtCong_Suat.Name = "txtCong_Suat";
            this.txtCong_Suat.OldValue = null;
            this.txtCong_Suat.Size = new System.Drawing.Size(428, 20);
            this.txtCong_Suat.TabIndex = 16;
            this.txtCong_Suat.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemDescription;
            this.txtCong_Suat.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.All;            
            // 
            // lblCong_Suat
            // 
            this.lblCong_Suat.AutoSize = true;
            this.lblCong_Suat.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblCong_Suat.Location = new System.Drawing.Point(12, 202);
            this.lblCong_Suat.Name = "lblCong_Suat";
            this.lblCong_Suat.Size = new System.Drawing.Size(49, 14);
            this.lblCong_Suat.TabIndex = 4;
            this.lblCong_Suat.Text = "Cấu hình";
            // 
            // grdDetail
            // 
            this.grdDetail.AllowUserToAddRows = false;
            this.grdDetail.AllowUserToDeleteRows = false;
            this.grdDetail.CheckAutoSize = true;
            this.grdDetail.CheckColor = false;
            this.grdDetail.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.grdDetail.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.Column1,
            this.Column2,
            this.Column3,
            this.Column4,
            this.Column5,
            this.Column6,
            this.Column7});
            this.grdDetail.Font = new System.Drawing.Font("Arial", 8.25F);
            this.grdDetail.Location = new System.Drawing.Point(0, 262);
            this.grdDetail.Name = "grdDetail";
            this.grdDetail.Size = new System.Drawing.Size(796, 151);
            this.grdDetail.TabIndex = 24;
            this.grdDetail.CellRightLeaved += new System.EventHandler(this.grdDetail_CellRightLeaved);
            this.grdDetail.CellBottomLeftLeaved += new System.EventHandler(this.grdDetail_CellBottomLeftLeaved);
            this.grdDetail.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.grdDetail_CellEndEdit);
            // 
            // Column1
            // 
            this.Column1.DataPropertyName = "Ma_TGTS";
            dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            this.Column1.DefaultCellStyle = dataGridViewCellStyle1;
            this.Column1.DestinationFields = "Ten_TGTS, Loai_TGTS";
            this.Column1.DisabledForeColor = System.Drawing.Color.Blue;
            this.Column1.EmptyIsValid = true;
            this.Column1.HeaderText = "Lý do";
            this.Column1.Name = "Column1";
            this.Column1.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column1.SourceFields = "Ten_TGTS, Loai_TGTS";
            this.Column1.TableName = "DMTGTS";
            this.Column1.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemCode;
            this.Column1.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.Right;
            this.Column1.Width = 72;
            // 
            // Column2
            // 
            this.Column2.DataPropertyName = "Ten_TGTS";
            this.Column2.HeaderText = "Diễn giải";
            this.Column2.Name = "Column2";
            this.Column2.Width = 209;
            // 
            // Column3
            // 
            this.Column3.DataPropertyName = "Ma_Nvon";
            dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            this.Column3.DefaultCellStyle = dataGridViewCellStyle2;
            this.Column3.DisabledForeColor = System.Drawing.Color.Blue;
            this.Column3.HeaderText = "Nguồn vốn";
            this.Column3.Name = "Column3";
            this.Column3.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column3.TableName = "DMNVON";
            this.Column3.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemCode;
            this.Column3.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.Right;
            this.Column3.Width = 72;
            // 
            // Column4
            // 
            this.Column4.DataPropertyName = "Tien0";
            dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            this.Column4.DefaultCellStyle = dataGridViewCellStyle3;
            this.Column4.HeaderText = "Nguyên giá";
            this.Column4.Name = "Column4";
            this.Column4.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column4.UserTextNumericFormat = SmartSoft.AppInstance.TextNumericFormat.LocalAmount;
            // 
            // Column5
            // 
            this.Column5.DataPropertyName = "Tien1";
            dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            this.Column5.DefaultCellStyle = dataGridViewCellStyle4;
            this.Column5.HeaderText = "Giá trị hao mòn";
            this.Column5.Name = "Column5";
            this.Column5.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column5.UserTextNumericFormat = SmartSoft.AppInstance.TextNumericFormat.LocalAmount;
            this.Column5.ZeroIsValid = true;
            // 
            // Column6
            // 
            this.Column6.DataPropertyName = "Tien3";
            dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            this.Column6.DefaultCellStyle = dataGridViewCellStyle5;
            this.Column6.HeaderText = "Giá trị còn lại";
            this.Column6.Name = "Column6";
            this.Column6.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column6.UserTextNumericFormat = SmartSoft.AppInstance.TextNumericFormat.LocalAmount;
            this.Column6.ZeroIsValid = true;
            // 
            // Column7
            // 
            this.Column7.DataPropertyName = "Tien4";
            dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            this.Column7.DefaultCellStyle = dataGridViewCellStyle6;
            this.Column7.HeaderText = "Giá trị tính khấu hao";
            this.Column7.Name = "Column7";
            this.Column7.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column7.UserTextNumericFormat = SmartSoft.AppInstance.TextNumericFormat.LocalAmount;
            this.Column7.ZeroIsValid = true;
            // 
            // txtDien_Giai
            // 
            this.txtDien_Giai.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtDien_Giai.CheckTextSearched = false;
            this.txtDien_Giai.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtDien_Giai.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtDien_Giai.Location = new System.Drawing.Point(123, 376);
            this.txtDien_Giai.MaxLength = 128;
            this.txtDien_Giai.Name = "txtDien_Giai";
            this.txtDien_Giai.OldValue = null;
            this.txtDien_Giai.Size = new System.Drawing.Size(661, 20);
            this.txtDien_Giai.TabIndex = 25;
            this.txtDien_Giai.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemDescription;
            this.txtDien_Giai.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.All;
            this.txtDien_Giai.Value = string.Empty;
            this.txtDien_Giai.Visible = false;
            // 
            // txtDesc_EN
            // 
            this.txtDesc_EN.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtDesc_EN.CheckTextSearched = false;
            this.txtDesc_EN.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtDesc_EN.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtDesc_EN.Location = new System.Drawing.Point(123, 397);
            this.txtDesc_EN.MaxLength = 128;
            this.txtDesc_EN.Name = "txtDesc_EN";
            this.txtDesc_EN.OldValue = null;
            this.txtDesc_EN.Size = new System.Drawing.Size(661, 20);
            this.txtDesc_EN.TabIndex = 26;
            this.txtDesc_EN.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemDescription;
            this.txtDesc_EN.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.All;
            this.txtDesc_EN.Value = string.Empty;
            this.txtDesc_EN.Visible = false;
            // 
            // lblDien_Giai
            // 
            this.lblDien_Giai.AutoSize = true;
            this.lblDien_Giai.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblDien_Giai.Location = new System.Drawing.Point(12, 379);
            this.lblDien_Giai.Name = "lblDien_Giai";
            this.lblDien_Giai.Size = new System.Drawing.Size(44, 14);
            this.lblDien_Giai.TabIndex = 17;
            this.lblDien_Giai.Text = "Ghi chú";
            this.lblDien_Giai.Visible = false;
            // 
            // lblDesc_EN
            // 
            this.lblDesc_EN.AutoSize = true;
            this.lblDesc_EN.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblDesc_EN.Location = new System.Drawing.Point(12, 400);
            this.lblDesc_EN.Name = "lblDesc_EN";
            this.lblDesc_EN.Size = new System.Drawing.Size(92, 14);
            this.lblDesc_EN.TabIndex = 4;
            this.lblDesc_EN.Text = "Ghi chú tiếng Anh";
            this.lblDesc_EN.Visible = false;
            // 
            // txtTinh_KH
            // 
            this.txtTinh_KH.CheckTextSearched = false;
            this.txtTinh_KH.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtTinh_KH.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTinh_KH.InputMask = "C,K";
            this.txtTinh_KH.Location = new System.Drawing.Point(123, 418);
            this.txtTinh_KH.Name = "txtTinh_KH";
            this.txtTinh_KH.OldValue = null;
            this.txtTinh_KH.Size = new System.Drawing.Size(25, 20);
            this.txtTinh_KH.TabIndex = 27;
            this.txtTinh_KH.Text = "C";
            this.txtTinh_KH.UserTextLength = SmartSoft.AppInstance.TextControlLength.None;
            this.txtTinh_KH.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.Right;
            this.txtTinh_KH.Value = "C";
            // 
            // lblTinh_KH
            // 
            this.lblTinh_KH.AutoSize = true;
            this.lblTinh_KH.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblTinh_KH.Location = new System.Drawing.Point(9, 421);
            this.lblTinh_KH.Name = "lblTinh_KH";
            this.lblTinh_KH.Size = new System.Drawing.Size(74, 14);
            this.lblTinh_KH.TabIndex = 4;
            this.lblTinh_KH.Text = "Tính khấu hao";
            // 
            // lblTinh_KH0
            // 
            this.lblTinh_KH0.AutoSize = true;
            this.lblTinh_KH0.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblTinh_KH0.ForeColor = System.Drawing.Color.Blue;
            this.lblTinh_KH0.Location = new System.Drawing.Point(154, 421);
            this.lblTinh_KH0.Name = "lblTinh_KH0";
            this.lblTinh_KH0.Size = new System.Drawing.Size(213, 14);
            this.lblTinh_KH0.TabIndex = 27;
            this.lblTinh_KH0.Text = "C-Có tính khấu hao, K-Không tính khấu hao";
            // 
            // lblTTien2
            // 
            this.lblTTien2.AutoSize = true;
            this.lblTTien2.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblTTien2.Location = new System.Drawing.Point(591, 485);
            this.lblTTien2.Name = "lblTTien2";
            this.lblTTien2.Size = new System.Drawing.Size(83, 14);
            this.lblTTien2.TabIndex = 39;
            this.lblTTien2.Text = "Khấu hao tháng";
            // 
            // txtKhauHaoThang
            // 
            this.txtKhauHaoThang.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtKhauHaoThang.Location = new System.Drawing.Point(684, 481);
            this.txtKhauHaoThang.Name = "txtKhauHaoThang";
            this.txtKhauHaoThang.NumericValue = new decimal(new int[] {
            0,
            0,
            0,
            0});
            this.txtKhauHaoThang.OldValue = null;
            this.txtKhauHaoThang.Size = new System.Drawing.Size(100, 20);
            this.txtKhauHaoThang.TabIndex = 35;
            this.txtKhauHaoThang.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            this.txtKhauHaoThang.UserTextNumericFormat = SmartSoft.AppInstance.TextNumericFormat.Quantity;
            this.txtKhauHaoThang.Value = 0;
            // 
            // lblTTien3
            // 
            this.lblTTien3.AutoSize = true;
            this.lblTTien3.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblTTien3.Location = new System.Drawing.Point(591, 464);
            this.lblTTien3.Name = "lblTTien3";
            this.lblTTien3.Size = new System.Drawing.Size(69, 14);
            this.lblTTien3.TabIndex = 39;
            this.lblTTien3.Text = "Giá trị còn lại";
            // 
            // txtGiaTriConLai
            // 
            this.txtGiaTriConLai.Enabled = false;
            this.txtGiaTriConLai.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtGiaTriConLai.Location = new System.Drawing.Point(684, 460);
            this.txtGiaTriConLai.Name = "txtGiaTriConLai";
            this.txtGiaTriConLai.NumericValue = new decimal(new int[] {
            0,
            0,
            0,
            0});
            this.txtGiaTriConLai.OldValue = null;
            this.txtGiaTriConLai.Size = new System.Drawing.Size(100, 20);
            this.txtGiaTriConLai.TabIndex = 34;
            this.txtGiaTriConLai.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            this.txtGiaTriConLai.UserTextNumericFormat = SmartSoft.AppInstance.TextNumericFormat.Quantity;
            this.txtGiaTriConLai.Value = 0;
            // 
            // lblTTien1
            // 
            this.lblTTien1.AutoSize = true;
            this.lblTTien1.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblTTien1.Location = new System.Drawing.Point(591, 443);
            this.lblTTien1.Name = "lblTTien1";
            this.lblTTien1.Size = new System.Drawing.Size(79, 14);
            this.lblTTien1.TabIndex = 39;
            this.lblTTien1.Text = "Giá trị hao mòn";
            // 
            // txtGiaTriHaoMon
            // 
            this.txtGiaTriHaoMon.Enabled = false;
            this.txtGiaTriHaoMon.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtGiaTriHaoMon.Location = new System.Drawing.Point(684, 439);
            this.txtGiaTriHaoMon.Name = "txtGiaTriHaoMon";
            this.txtGiaTriHaoMon.NumericValue = new decimal(new int[] {
            0,
            0,
            0,
            0});
            this.txtGiaTriHaoMon.OldValue = null;
            this.txtGiaTriHaoMon.Size = new System.Drawing.Size(100, 20);
            this.txtGiaTriHaoMon.TabIndex = 33;
            this.txtGiaTriHaoMon.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            this.txtGiaTriHaoMon.UserTextNumericFormat = SmartSoft.AppInstance.TextNumericFormat.Quantity;
            this.txtGiaTriHaoMon.Value = 0;
            // 
            // lblTTien0
            // 
            this.lblTTien0.AutoSize = true;
            this.lblTTien0.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblTTien0.Location = new System.Drawing.Point(591, 422);
            this.lblTTien0.Name = "lblTTien0";
            this.lblTTien0.Size = new System.Drawing.Size(87, 14);
            this.lblTTien0.TabIndex = 39;
            this.lblTTien0.Text = "Tổng nguyên giá";
            // 
            // txtTongNguyenGia
            // 
            this.txtTongNguyenGia.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTongNguyenGia.Location = new System.Drawing.Point(684, 418);
            this.txtTongNguyenGia.Name = "txtTongNguyenGia";
            this.txtTongNguyenGia.NumericValue = new decimal(new int[] {
            0,
            0,
            0,
            0});
            this.txtTongNguyenGia.OldValue = null;
            this.txtTongNguyenGia.ReadOnly = true;
            this.txtTongNguyenGia.Size = new System.Drawing.Size(100, 20);
            this.txtTongNguyenGia.TabIndex = 32;
            this.txtTongNguyenGia.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            this.txtTongNguyenGia.UserTextNumericFormat = SmartSoft.AppInstance.TextNumericFormat.Quantity;
            this.txtTongNguyenGia.Value = 0;
            // 
            // lblNgay_KH
            // 
            this.lblNgay_KH.AutoSize = true;
            this.lblNgay_KH.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblNgay_KH.Location = new System.Drawing.Point(229, 443);
            this.lblNgay_KH.Name = "lblNgay_KH";
            this.lblNgay_KH.Size = new System.Drawing.Size(79, 14);
            this.lblNgay_KH.TabIndex = 39;
            this.lblNgay_KH.Text = "Ngày khấu hao";
            // 
            // txtNgay_KH
            // 
            this.txtNgay_KH.DateTimeFormat = SmartSoft.Controls.TextDate.DateTimeFormatType.Date;
            this.txtNgay_KH.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtNgay_KH.InsertKeyMode = System.Windows.Forms.InsertKeyMode.Overwrite;
            this.txtNgay_KH.Location = new System.Drawing.Point(325, 440);
            this.txtNgay_KH.Mask = "00/00/0000";
            this.txtNgay_KH.Name = "txtNgay_KH";
            this.txtNgay_KH.OldValue = null;
            this.txtNgay_KH.Size = new System.Drawing.Size(85, 20);
            this.txtNgay_KH.TabIndex = 28;            
            // 
            // lblSo_Thang
            // 
            this.lblSo_Thang.AutoSize = true;
            this.lblSo_Thang.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblSo_Thang.Location = new System.Drawing.Point(411, 442);
            this.lblSo_Thang.Name = "lblSo_Thang";
            this.lblSo_Thang.Size = new System.Drawing.Size(97, 14);
            this.lblSo_Thang.TabIndex = 39;
            this.lblSo_Thang.Text = "Số tháng khấu hao";
            // 
            // txtSo_Thang
            // 
            this.txtSo_Thang.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtSo_Thang.Location = new System.Drawing.Point(514, 439);
            this.txtSo_Thang.Name = "txtSo_Thang";
            this.txtSo_Thang.NumericScaleOnFocus = 0;
            this.txtSo_Thang.NumericScaleOnLostFocus = 0;
            this.txtSo_Thang.NumericValue = new decimal(new int[] {
            0,
            0,
            0,
            0});
            this.txtSo_Thang.OldValue = null;
            this.txtSo_Thang.Size = new System.Drawing.Size(37, 20);
            this.txtSo_Thang.TabIndex = 29;
            this.txtSo_Thang.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            this.txtSo_Thang.UserTextNumericFormat = SmartSoft.AppInstance.TextNumericFormat.None;            
            this.txtSo_Thang.Validated += new System.EventHandler(this.txtSo_Thang_Validated);
            // 
            // lblTk_Co
            // 
            this.lblTk_Co.AutoSize = true;
            this.lblTk_Co.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblTk_Co.Location = new System.Drawing.Point(9, 484);
            this.lblTk_Co.Name = "lblTk_Co";
            this.lblTk_Co.Size = new System.Drawing.Size(97, 14);
            this.lblTk_Co.TabIndex = 4;
            this.lblTk_Co.Text = "Tài khoản hao mòn";
            // 
            // lblTk_No
            // 
            this.lblTk_No.AutoSize = true;
            this.lblTk_No.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblTk_No.Location = new System.Drawing.Point(9, 463);
            this.lblTk_No.Name = "lblTk_No";
            this.lblTk_No.Size = new System.Drawing.Size(87, 14);
            this.lblTk_No.TabIndex = 4;
            this.lblTk_No.Text = "Tài khoản chi phí";
            // 
            // txtTk_Co
            // 
            this.txtTk_Co.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtTk_Co.CheckTextSearched = false;
            this.txtTk_Co.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtTk_Co.FieldDisplay = "Ten_Nh_Vt";
            this.txtTk_Co.FirstFilter = "Loai_Tk = \'C\'";
            this.txtTk_Co.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTk_Co.Location = new System.Drawing.Point(123, 481);
            this.txtTk_Co.MaxLength = 32;
            this.txtTk_Co.Name = "txtTk_Co";
            this.txtTk_Co.OldValue = null;
            this.txtTk_Co.Size = new System.Drawing.Size(100, 20);
            this.txtTk_Co.TabIndex = 31;
            this.txtTk_Co.TableName = "DMTK";
            this.txtTk_Co.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemCode;
            this.txtTk_Co.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.All;
            this.txtTk_Co.Value = string.Empty;
            // 
            // txtTk_No
            // 
            this.txtTk_No.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtTk_No.CheckTextSearched = false;
            this.txtTk_No.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtTk_No.FieldDisplay = "Ten_Sp";
            this.txtTk_No.FirstFilter = "Loai_Tk = \'C\'";
            this.txtTk_No.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTk_No.Location = new System.Drawing.Point(123, 460);
            this.txtTk_No.MaxLength = 32;
            this.txtTk_No.Name = "txtTk_No";
            this.txtTk_No.OldValue = null;
            this.txtTk_No.Size = new System.Drawing.Size(100, 20);
            this.txtTk_No.TabIndex = 30;
            this.txtTk_No.TableName = "DMTK";
            this.txtTk_No.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemCode;
            this.txtTk_No.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.All;
            this.txtTk_No.Value = string.Empty;
            // 
            // txtTen_Ncc
            // 
            this.txtTen_Ncc.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTen_Ncc.BackColor = System.Drawing.SystemColors.Control;
            this.txtTen_Ncc.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtTen_Ncc.CheckTextSearched = false;
            this.txtTen_Ncc.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtTen_Ncc.Enabled = false;
            this.txtTen_Ncc.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_Ncc.ForeColor = System.Drawing.Color.Blue;
            this.txtTen_Ncc.Location = new System.Drawing.Point(232, 137);
            this.txtTen_Ncc.Name = "txtTen_Ncc";
            this.txtTen_Ncc.OldValue = null;
            this.txtTen_Ncc.Size = new System.Drawing.Size(163, 13);
            this.txtTen_Ncc.TabIndex = 10;
            this.txtTen_Ncc.UserTextLength = SmartSoft.AppInstance.TextControlLength.None;
            this.txtTen_Ncc.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.Right;
            this.txtTen_Ncc.Value = string.Empty;
            // 
            // txtMa_Ncc
            // 
            this.txtMa_Ncc.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtMa_Ncc.CheckTextSearched = false;
            this.txtMa_Ncc.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtMa_Ncc.FieldDisplay = "Ten_Dt";
            this.txtMa_Ncc.FirstFilter = "Is_Stop = \'1\'";
            this.txtMa_Ncc.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtMa_Ncc.Location = new System.Drawing.Point(123, 133);
            this.txtMa_Ncc.MaxLength = 32;
            this.txtMa_Ncc.Name = "txtMa_Ncc";
            this.txtMa_Ncc.OldValue = null;
            this.txtMa_Ncc.Size = new System.Drawing.Size(100, 20);
            this.txtMa_Ncc.TabIndex = 9;
            this.txtMa_Ncc.TableName = "DMDT";
            this.txtMa_Ncc.TextDisplay = this.txtTen_Ncc;
            this.txtMa_Ncc.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemCode;
            this.txtMa_Ncc.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.All;
            this.txtMa_Ncc.Value = string.Empty;
            // 
            // lblMa_Ncc
            // 
            this.lblMa_Ncc.AutoSize = true;
            this.lblMa_Ncc.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblMa_Ncc.Location = new System.Drawing.Point(12, 136);
            this.lblMa_Ncc.Name = "lblMa_Ncc";
            this.lblMa_Ncc.Size = new System.Drawing.Size(74, 14);
            this.lblMa_Ncc.TabIndex = 111;
            this.lblMa_Ncc.Text = "Nhà cung cấp";
            // 
            // txtHan_Bh
            // 
            this.txtHan_Bh.DateTimeFormat = SmartSoft.Controls.TextDate.DateTimeFormatType.Date;
            this.txtHan_Bh.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtHan_Bh.InsertKeyMode = System.Windows.Forms.InsertKeyMode.Overwrite;
            this.txtHan_Bh.Location = new System.Drawing.Point(451, 133);
            this.txtHan_Bh.Mask = "00/00/0000";
            this.txtHan_Bh.Name = "txtHan_Bh";
            this.txtHan_Bh.OldValue = null;
            this.txtHan_Bh.Size = new System.Drawing.Size(100, 20);
            this.txtHan_Bh.TabIndex = 11;            
            // 
            // lblHan_Bh
            // 
            this.lblHan_Bh.AutoSize = true;
            this.lblHan_Bh.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblHan_Bh.Location = new System.Drawing.Point(384, 136);
            this.lblHan_Bh.Name = "lblHan_Bh";
            this.lblHan_Bh.Size = new System.Drawing.Size(63, 14);
            this.lblHan_Bh.TabIndex = 113;
            this.lblHan_Bh.Text = "Hạn B.hành";
            // 
            // txtTen_Nsx
            // 
            this.txtTen_Nsx.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTen_Nsx.BackColor = System.Drawing.SystemColors.Control;
            this.txtTen_Nsx.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtTen_Nsx.CheckTextSearched = false;
            this.txtTen_Nsx.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtTen_Nsx.Enabled = false;
            this.txtTen_Nsx.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_Nsx.ForeColor = System.Drawing.Color.Blue;
            this.txtTen_Nsx.Location = new System.Drawing.Point(232, 158);
            this.txtTen_Nsx.Name = "txtTen_Nsx";
            this.txtTen_Nsx.OldValue = null;
            this.txtTen_Nsx.Size = new System.Drawing.Size(163, 13);
            this.txtTen_Nsx.TabIndex = 13;
            this.txtTen_Nsx.UserTextLength = SmartSoft.AppInstance.TextControlLength.None;
            this.txtTen_Nsx.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.Right;
            this.txtTen_Nsx.Value = string.Empty;
            // 
            // txtMa_Nsx
            // 
            this.txtMa_Nsx.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtMa_Nsx.CheckTextSearched = false;
            this.txtMa_Nsx.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtMa_Nsx.FieldDisplay = "Ten_Dt";
            this.txtMa_Nsx.FirstFilter = "Is_Stop = \'1\'";
            this.txtMa_Nsx.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtMa_Nsx.Location = new System.Drawing.Point(123, 154);
            this.txtMa_Nsx.MaxLength = 32;
            this.txtMa_Nsx.Name = "txtMa_Nsx";
            this.txtMa_Nsx.OldValue = null;
            this.txtMa_Nsx.Size = new System.Drawing.Size(100, 20);
            this.txtMa_Nsx.TabIndex = 12;
            this.txtMa_Nsx.TableName = "DMDT";
            this.txtMa_Nsx.TextDisplay = this.txtTen_Nsx;
            this.txtMa_Nsx.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemCode;
            this.txtMa_Nsx.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.All;
            this.txtMa_Nsx.Value = string.Empty;
            // 
            // lblMa_Nsx
            // 
            this.lblMa_Nsx.AutoSize = true;
            this.lblMa_Nsx.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblMa_Nsx.Location = new System.Drawing.Point(12, 157);
            this.lblMa_Nsx.Name = "lblMa_Nsx";
            this.lblMa_Nsx.Size = new System.Drawing.Size(71, 14);
            this.lblMa_Nsx.TabIndex = 116;
            this.lblMa_Nsx.Text = "Nhà sản xuất";
            // 
            // lblLoai_Ts
            // 
            this.lblLoai_Ts.AutoSize = true;
            this.lblLoai_Ts.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblLoai_Ts.Location = new System.Drawing.Point(229, 222);
            this.lblLoai_Ts.Name = "lblLoai_Ts";
            this.lblLoai_Ts.Size = new System.Drawing.Size(62, 14);
            this.lblLoai_Ts.TabIndex = 117;
            this.lblLoai_Ts.Text = "Loại tài sản";
            // 
            // txtLoai_Ts
            // 
            this.txtLoai_Ts.CheckTextSearched = false;
            this.txtLoai_Ts.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtLoai_Ts.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtLoai_Ts.InputMask = "C,K";
            this.txtLoai_Ts.Location = new System.Drawing.Point(294, 219);
            this.txtLoai_Ts.Name = "txtLoai_Ts";
            this.txtLoai_Ts.OldValue = null;
            this.txtLoai_Ts.Size = new System.Drawing.Size(28, 20);
            this.txtLoai_Ts.TabIndex = 18;
            this.txtLoai_Ts.Text = "C";
            this.txtLoai_Ts.UserTextLength = SmartSoft.AppInstance.TextControlLength.None;
            this.txtLoai_Ts.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.Right;
            this.txtLoai_Ts.Value = "C";
            // 
            // lblIsLoai_Ts
            // 
            this.lblIsLoai_Ts.AutoSize = true;
            this.lblIsLoai_Ts.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblIsLoai_Ts.ForeColor = System.Drawing.Color.Blue;
            this.lblIsLoai_Ts.Location = new System.Drawing.Point(324, 222);
            this.lblIsLoai_Ts.Name = "lblIsLoai_Ts";
            this.lblIsLoai_Ts.Size = new System.Drawing.Size(85, 14);
            this.lblIsLoai_Ts.TabIndex = 119;
            this.lblIsLoai_Ts.Text = "C-T.Sản, K-C.Cụ";
            // 
            // txtNuoc_Sx
            // 
            this.txtNuoc_Sx.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtNuoc_Sx.BackColor = System.Drawing.SystemColors.Control;
            this.txtNuoc_Sx.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtNuoc_Sx.CheckTextSearched = false;
            this.txtNuoc_Sx.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtNuoc_Sx.Enabled = false;
            this.txtNuoc_Sx.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtNuoc_Sx.ForeColor = System.Drawing.Color.Blue;
            this.txtNuoc_Sx.Location = new System.Drawing.Point(232, 180);
            this.txtNuoc_Sx.Name = "txtNuoc_Sx";
            this.txtNuoc_Sx.OldValue = null;
            this.txtNuoc_Sx.Size = new System.Drawing.Size(140, 13);
            this.txtNuoc_Sx.TabIndex = 121;
            this.txtNuoc_Sx.UserTextLength = SmartSoft.AppInstance.TextControlLength.None;
            this.txtNuoc_Sx.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.Right;
            // 
            // txtMa_Qg
            // 
            this.txtMa_Qg.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtMa_Qg.CheckTextSearched = false;
            this.txtMa_Qg.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtMa_Qg.FieldDisplay = "Ten_Qg";
            this.txtMa_Qg.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtMa_Qg.Location = new System.Drawing.Point(123, 176);
            this.txtMa_Qg.MaxLength = 32;
            this.txtMa_Qg.Name = "txtMa_Qg";
            this.txtMa_Qg.OldValue = null;
            this.txtMa_Qg.Size = new System.Drawing.Size(100, 20);
            this.txtMa_Qg.TabIndex = 13;
            this.txtMa_Qg.TableName = "DMQG";
            this.txtMa_Qg.TextDisplay = this.txtNuoc_Sx;
            this.txtMa_Qg.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemCode;
            this.txtMa_Qg.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.All;
            // 
            // txtNam_Sx
            // 
            this.txtNam_Sx.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtNam_Sx.CheckTextSearched = false;
            this.txtNam_Sx.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtNam_Sx.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtNam_Sx.Location = new System.Drawing.Point(451, 176);
            this.txtNam_Sx.MaxLength = 4;
            this.txtNam_Sx.Name = "txtNam_Sx";
            this.txtNam_Sx.OldValue = null;
            this.txtNam_Sx.Size = new System.Drawing.Size(100, 20);
            this.txtNam_Sx.TabIndex = 14;
            this.txtNam_Sx.UserTextLength = SmartSoft.AppInstance.TextControlLength.None;
            this.txtNam_Sx.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.All;
            // 
            // labelControl1
            // 
            this.labelControl1.AutoSize = true;
            this.labelControl1.Font = new System.Drawing.Font("Arial", 8.25F);
            this.labelControl1.Location = new System.Drawing.Point(8, 442);
            this.labelControl1.Name = "labelControl1";
            this.labelControl1.Size = new System.Drawing.Size(118, 14);
            this.labelControl1.TabIndex = 122;
            this.labelControl1.Text = "Ngày bắt đầu khấu hao";
            // 
            // txtNgay_BDKH
            // 
            this.txtNgay_BDKH.DateTimeFormat = SmartSoft.Controls.TextDate.DateTimeFormatType.Date;
            this.txtNgay_BDKH.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtNgay_BDKH.InsertKeyMode = System.Windows.Forms.InsertKeyMode.Overwrite;
            this.txtNgay_BDKH.Location = new System.Drawing.Point(123, 439);
            this.txtNgay_BDKH.Mask = "00/00/0000";
            this.txtNgay_BDKH.Name = "txtNgay_BDKH";
            this.txtNgay_BDKH.OldValue = null;
            this.txtNgay_BDKH.Size = new System.Drawing.Size(100, 20);
            this.txtNgay_BDKH.TabIndex = 27;
            
            // 
            // txtMa_Dvt
            // 
            this.txtMa_Dvt.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtMa_Dvt.CheckTextSearched = false;
            this.txtMa_Dvt.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtMa_Dvt.FieldDisplay = "Ten_Dvt";
            this.txtMa_Dvt.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtMa_Dvt.Location = new System.Drawing.Point(123, 91);
            this.txtMa_Dvt.MaxLength = 32;
            this.txtMa_Dvt.Name = "txtMa_Dvt";
            this.txtMa_Dvt.OldValue = null;
            this.txtMa_Dvt.Size = new System.Drawing.Size(100, 20);
            this.txtMa_Dvt.TabIndex = 5;
            this.txtMa_Dvt.TableName = "DMDVT";
            this.txtMa_Dvt.TextDisplay = this.txtTen_Dvt;
            this.txtMa_Dvt.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemCode;
            this.txtMa_Dvt.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.All;
            // 
            // txtTen_Dvt
            // 
            this.txtTen_Dvt.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTen_Dvt.BackColor = System.Drawing.SystemColors.Control;
            this.txtTen_Dvt.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtTen_Dvt.CheckTextSearched = false;
            this.txtTen_Dvt.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtTen_Dvt.Enabled = false;
            this.txtTen_Dvt.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_Dvt.ForeColor = System.Drawing.Color.Blue;
            this.txtTen_Dvt.Location = new System.Drawing.Point(232, 94);
            this.txtTen_Dvt.Name = "txtTen_Dvt";
            this.txtTen_Dvt.OldValue = null;
            this.txtTen_Dvt.Size = new System.Drawing.Size(158, 13);
            this.txtTen_Dvt.TabIndex = 124;
            this.txtTen_Dvt.UserTextLength = SmartSoft.AppInstance.TextControlLength.None;
            this.txtTen_Dvt.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.Right;
            // 
            // FormDmTsEditor
            // 
            this.AddTitleText = "Thêm mới tài sản";
            this.ClientSize = new System.Drawing.Size(796, 534);
            this.Controls.Add(this.txtTen_Dvt);
            this.Controls.Add(this.txtMa_Dvt);
            this.Controls.Add(this.txtNgay_BDKH);
            this.Controls.Add(this.labelControl1);
            this.Controls.Add(this.txtNam_Sx);
            this.Controls.Add(this.txtNuoc_Sx);
            this.Controls.Add(this.txtMa_Qg);
            this.Controls.Add(this.txtLoai_Ts);
            this.Controls.Add(this.lblIsLoai_Ts);
            this.Controls.Add(this.lblLoai_Ts);
            this.Controls.Add(this.txtTen_Nh_Ts);
            this.Controls.Add(this.txtTen_Bp);
            this.Controls.Add(this.txtTen_Nsx);
            this.Controls.Add(this.txtMa_Nsx);
            this.Controls.Add(this.lblMa_Nsx);
            this.Controls.Add(this.txtHan_Bh);
            this.Controls.Add(this.lblHan_Bh);
            this.Controls.Add(this.txtTen_Ncc);
            this.Controls.Add(this.txtMa_Ncc);
            this.Controls.Add(this.lblMa_Ncc);
            this.Controls.Add(this.txtTinh_KH);
            this.Controls.Add(this.grdDetail);
            this.Controls.Add(this.txtNgay_KH);
            this.Controls.Add(this.txtNgay_Ts);
            this.Controls.Add(this.txtTongNguyenGia);
            this.Controls.Add(this.txtGiaTriHaoMon);
            this.Controls.Add(this.txtGiaTriConLai);
            this.Controls.Add(this.lblTTien0);
            this.Controls.Add(this.txtKhauHaoThang);
            this.Controls.Add(this.lblTTien1);
            this.Controls.Add(this.txtSo_Thang);
            this.Controls.Add(this.txtSo_Luong);
            this.Controls.Add(this.lblTTien3);
            this.Controls.Add(this.lblNam_Sx);
            this.Controls.Add(this.lblNgay_KH);
            this.Controls.Add(this.lblTTien2);
            this.Controls.Add(this.lblSo_Thang);
            this.Controls.Add(this.lblNgay_Ts);
            this.Controls.Add(this.lblSo_Luong);
            this.Controls.Add(this.txtMa_Bp);
            this.Controls.Add(this.pnlPicture);
            this.Controls.Add(this.txtTk_No);
            this.Controls.Add(this.txtTk_Co);
            this.Controls.Add(this.txtMa_MDSD);
            this.Controls.Add(this.txtMa_Nh_Ts);
            this.Controls.Add(this.txtTk);
            this.Controls.Add(this.lblCong_Suat);
            this.Controls.Add(this.lblTinh_KH0);
            this.Controls.Add(this.lblTinh_KH);
            this.Controls.Add(this.lblDesc_EN);
            this.Controls.Add(this.lblTen_Ts_E);
            this.Controls.Add(this.lblTk_No);
            this.Controls.Add(this.lblMa_Bp);
            this.Controls.Add(this.lblTk_Co);
            this.Controls.Add(this.lblMa_MDSD);
            this.Controls.Add(this.lblMa_Nh_Ts);
            this.Controls.Add(this.lblTk);
            this.Controls.Add(this.lblDien_Giai);
            this.Controls.Add(this.lblTen_Ts);
            this.Controls.Add(this.lblSo_Ct_T);
            this.Controls.Add(this.lblNuoc_Sx);
            this.Controls.Add(this.lblDvt);
            this.Controls.Add(this.lblSo_Hieu);
            this.Controls.Add(this.lblThe_Ts);
            this.Controls.Add(this.lblMa_Ts);
            this.Controls.Add(this.txtCong_Suat);
            this.Controls.Add(this.txtDesc_EN);
            this.Controls.Add(this.txtTen_Ts_E);
            this.Controls.Add(this.txtDien_Giai);
            this.Controls.Add(this.txtTen_Ts);
            this.Controls.Add(this.txtSo_Ct_T);
            this.Controls.Add(this.txtSo_Hieu);
            this.Controls.Add(this.txtThe_Ts);
            this.Controls.Add(this.txtMa_Ts);
            this.EditTitleText = "Sửa tài sản";
            this.FirstFreeCode = "TS1";
            this.MinimumSize = new System.Drawing.Size(802, 566);
            this.Name = "FormDmTsEditor";
            this.SecondFreeCode = "TS2";
            this.Text = "Thêm mới tài sản";
            this.ThirdFreeCode = "TS3";
            this.Load += new System.EventHandler(this.FormDmTsEditor_Load);
            this.Controls.SetChildIndex(this.lblPhan_Loai, 0);
            this.Controls.SetChildIndex(this.txtMa_Loai1, 0);
            this.Controls.SetChildIndex(this.txtMa_Loai2, 0);
            this.Controls.SetChildIndex(this.txtMa_Loai3, 0);
            this.Controls.SetChildIndex(this.txtMa_Ts, 0);
            this.Controls.SetChildIndex(this.txtThe_Ts, 0);
            this.Controls.SetChildIndex(this.txtSo_Hieu, 0);
            this.Controls.SetChildIndex(this.txtSo_Ct_T, 0);
            this.Controls.SetChildIndex(this.txtTen_Ts, 0);
            this.Controls.SetChildIndex(this.txtDien_Giai, 0);
            this.Controls.SetChildIndex(this.txtTen_Ts_E, 0);
            this.Controls.SetChildIndex(this.txtDesc_EN, 0);
            this.Controls.SetChildIndex(this.txtCong_Suat, 0);
            this.Controls.SetChildIndex(this.lblMa_Ts, 0);
            this.Controls.SetChildIndex(this.lblThe_Ts, 0);
            this.Controls.SetChildIndex(this.lblSo_Hieu, 0);
            this.Controls.SetChildIndex(this.lblDvt, 0);
            this.Controls.SetChildIndex(this.lblNuoc_Sx, 0);
            this.Controls.SetChildIndex(this.lblSo_Ct_T, 0);
            this.Controls.SetChildIndex(this.lblTen_Ts, 0);
            this.Controls.SetChildIndex(this.lblDien_Giai, 0);
            this.Controls.SetChildIndex(this.lblTk, 0);
            this.Controls.SetChildIndex(this.lblMa_Nh_Ts, 0);
            this.Controls.SetChildIndex(this.lblMa_MDSD, 0);
            this.Controls.SetChildIndex(this.lblTk_Co, 0);
            this.Controls.SetChildIndex(this.lblMa_Bp, 0);
            this.Controls.SetChildIndex(this.lblTk_No, 0);
            this.Controls.SetChildIndex(this.lblTen_Ts_E, 0);
            this.Controls.SetChildIndex(this.lblDesc_EN, 0);
            this.Controls.SetChildIndex(this.lblTinh_KH, 0);
            this.Controls.SetChildIndex(this.lblTinh_KH0, 0);
            this.Controls.SetChildIndex(this.lblCong_Suat, 0);
            this.Controls.SetChildIndex(this.txtTk, 0);
            this.Controls.SetChildIndex(this.txtMa_Nh_Ts, 0);
            this.Controls.SetChildIndex(this.txtMa_MDSD, 0);
            this.Controls.SetChildIndex(this.txtTk_Co, 0);
            this.Controls.SetChildIndex(this.txtTk_No, 0);
            this.Controls.SetChildIndex(this.pnlPicture, 0);
            this.Controls.SetChildIndex(this.txtMa_Bp, 0);
            this.Controls.SetChildIndex(this.lblSo_Luong, 0);
            this.Controls.SetChildIndex(this.lblNgay_Ts, 0);
            this.Controls.SetChildIndex(this.lblSo_Thang, 0);
            this.Controls.SetChildIndex(this.lblTTien2, 0);
            this.Controls.SetChildIndex(this.lblNgay_KH, 0);
            this.Controls.SetChildIndex(this.lblNam_Sx, 0);
            this.Controls.SetChildIndex(this.lblTTien3, 0);
            this.Controls.SetChildIndex(this.txtSo_Luong, 0);
            this.Controls.SetChildIndex(this.txtSo_Thang, 0);
            this.Controls.SetChildIndex(this.lblTTien1, 0);
            this.Controls.SetChildIndex(this.txtKhauHaoThang, 0);
            this.Controls.SetChildIndex(this.lblTTien0, 0);
            this.Controls.SetChildIndex(this.txtGiaTriConLai, 0);
            this.Controls.SetChildIndex(this.txtGiaTriHaoMon, 0);
            this.Controls.SetChildIndex(this.txtTongNguyenGia, 0);
            this.Controls.SetChildIndex(this.txtNgay_Ts, 0);
            this.Controls.SetChildIndex(this.txtNgay_KH, 0);
            this.Controls.SetChildIndex(this.grdDetail, 0);
            this.Controls.SetChildIndex(this.txtTinh_KH, 0);
            this.Controls.SetChildIndex(this.lblMa_Ncc, 0);
            this.Controls.SetChildIndex(this.txtMa_Ncc, 0);
            this.Controls.SetChildIndex(this.txtTen_Ncc, 0);
            this.Controls.SetChildIndex(this.lblHan_Bh, 0);
            this.Controls.SetChildIndex(this.txtHan_Bh, 0);
            this.Controls.SetChildIndex(this.lblMa_Nsx, 0);
            this.Controls.SetChildIndex(this.txtMa_Nsx, 0);
            this.Controls.SetChildIndex(this.txtTen_Nsx, 0);
            this.Controls.SetChildIndex(this.txtTen_Bp, 0);
            this.Controls.SetChildIndex(this.txtTen_Nh_Ts, 0);
            this.Controls.SetChildIndex(this.lblLoai_Ts, 0);
            this.Controls.SetChildIndex(this.lblIsLoai_Ts, 0);
            this.Controls.SetChildIndex(this.txtLoai_Ts, 0);
            this.Controls.SetChildIndex(this.txtMa_Qg, 0);
            this.Controls.SetChildIndex(this.txtNuoc_Sx, 0);
            this.Controls.SetChildIndex(this.txtNam_Sx, 0);
            this.Controls.SetChildIndex(this.labelControl1, 0);
            this.Controls.SetChildIndex(this.txtNgay_BDKH, 0);
            this.Controls.SetChildIndex(this.txtMa_Dvt, 0);
            this.Controls.SetChildIndex(this.txtTen_Dvt, 0);
            ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
            this.pnlPicture.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.PictureBox)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.grdDetail)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        protected override void OnReset()
        {
            if (base.NewChecked)
            {
                if (base.LocalCurrentRow == null)
                {
                    this.oMasterRow = this.oMethod.GetMasterDataRow("SSSOFT2009");
                }
                this.oMasterRow["Stt"] = SSDataAccess.Cong_So_Tt(AppInstance.Subsidiary);
                this.oMasterRow["Ngay_Ts"] = DateTime.Today;
                this.oMasterRow["Ngay_KH"] = DateTime.Today;
                this.oMasterRow["Han_Bh"] = DateTime.Today;
                this.oMasterRow["So_Thang"] = 0;
                this.oMasterRow["TTien0"] = 0;
                this.oMasterRow["TTien1"] = 0;
                this.oMasterRow["TTien2"] = 0;
                this.oMasterRow["TTien3"] = 0;
                this.oMasterRow["TTien4"] = 0;
                if (this.oDetailTable == null)
                {
                    this.oDetailTable = this.oMethod.GetDetailTable(this.oMasterRow["Stt"]);
                }
                DataRow row = this.oDetailTable.NewRow();
                row["Stt0"] = SSDataAccess.Cong_So_Tt(AppInstance.Subsidiary);
                row["Tien0"] = 0;
                row["Tien1"] = 0;
                row["Loai_TGTS"] = "T";
                row["Tien3"] = 0;
                row["Tien4"] = 0;
                this.oDetailTable.Rows.Clear();
                this.oDetailTable.Rows.Add(row);
                if ((base.LocalCurrentRow == null) && (base.LocalFormLister.ParentCurrentRow != null))
                {
                    this.txtMa_Nh_Ts.Text = base.LocalFormLister.ParentCurrentRow[base.LocalFormLister.ParentFieldName].ToString();
                }
            }
            else
            {
                this.oDetailTable = this.oMethod.GetDetailTable(this.oMasterRow["Stt"]);
            }
            this.txtNgay_Ts.Value = this.oMasterRow["Ngay_Ts"];
            this.txtNgay_KH.Value = this.oMasterRow["Ngay_KH"];
            this.txtSo_Thang.Value = this.oMasterRow["So_Thang"];
            this.txtTongNguyenGia.Value = this.oMasterRow["TTien0"];
            this.txtGiaTriHaoMon.Value = this.oMasterRow["TTien1"];
            this.txtGiaTriConLai.Value = this.oMasterRow["TTien3"];
            this.txtKhauHaoThang.Value = this.oMasterRow["TTien2"];
            this.grdDetail.DataSource = new BindingSource(this.oDetailTable, string.Empty);
            base.OnReset();
        }

        public bool OnSaveFromExcel(string fileName)
        {
            //DataSet dsProduct = ExcelHelper.CreateDataSet(fileName, false, false);
            //foreach (DataTable table in dsProduct.Tables)
            //{
            //    if (table.TableName.Contains("TS"))
            //    {
            //        string tableName = "TS";
            //    }
            //    else
            //    {

            //    }
            //}
            return false;
        }

        public override bool OnSave()
        {            
            //OnSaveFromExcel(@"D:\2. PROJECTS\VBSP\PHAN MEM QUAN LY THIET BI\DOCUMENTS\DATA_CONVERT.xlsx");
             

            //return false;
            DataRow localCurrentRow;
            if (string.IsNullOrEmpty(this.txtMa_Ts.Text))
            {
                MessageBox.Show("Chưa nhập mã tài sản!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (string.IsNullOrEmpty(this.txtThe_Ts.Text))
            {
                MessageBox.Show("Chưa nhập số thẻ tài sản!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (string.IsNullOrEmpty(this.txtSo_Hieu.Text))
            {
                MessageBox.Show("Chưa nhập số hiệu tài sản!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (string.IsNullOrEmpty(this.txtTen_Ts.Text))
            {
                MessageBox.Show("Chưa nhập tên tài sản!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (string.IsNullOrEmpty(this.txtMa_Dvt.Text))
            {
                MessageBox.Show("Chưa nhập đơn vị tính!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (string.IsNullOrEmpty(this.txtMa_Nh_Ts.Text))
            {
                MessageBox.Show("Chưa nhập mã nhóm tài sản!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (this.txtNgay_Ts.Value.Equals(DBNull.Value))
            {
                MessageBox.Show("Chưa nhập ngày tăng tài sản!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (this.txtNgay_KH.Value.Equals(DBNull.Value))
            {
                MessageBox.Show("Chưa nhập ngày tính khấu hao!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (this.txtSo_Luong.NumericValue == 0M)
            {
                MessageBox.Show("Chưa nhập số lượng tài sản!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (this.txtSo_Thang.NumericValue == 0M)
            {
                if (this.txtTinh_KH.Text.Equals("K"))
                {
                    this.txtSo_Thang.Value = 1M;
                }
                else
                {
                    MessageBox.Show("Chưa nhập số tháng khấu hao!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    return false;
                }
            }

            if (this.txtSo_Thang.NumericValue == 1M)
            {
                this.txtKhauHaoThang.Value = this.txtTongNguyenGia.Value;
            }

            this.oMasterRow["Ma_Dvcs"] = AppInstance.Subsidiary;
            this.oMasterRow["Ma_Ts"] = this.txtMa_Ts.Value;
            this.oMasterRow["The_Ts"] = this.txtThe_Ts.Value;
            this.oMasterRow["So_Hieu"] = this.txtSo_Hieu.Value;
            this.oMasterRow["Ten_Ts"] = this.txtTen_Ts.Value;
            this.oMasterRow["Ten_Ts_E"] = this.txtTen_Ts_E.Value;
            //this.oMasterRow["Ma_Dvt"] = this.txtMa_Dvt.Value;
            this.oMasterRow["Loai_Ts"] = this.FixedAssetType;
            this.oMasterRow["So_Luong"] = this.txtSo_Luong.Value;
            this.oMasterRow["So_Ct_T"] = this.txtSo_Ct_T.Value;
            this.oMasterRow["Ngay_Ts"] = this.txtNgay_Ts.Value;
            this.oMasterRow["Nuoc_Sx"] = this.txtNuoc_Sx.Value;
            this.oMasterRow["Nam_Sx"] = this.txtNam_Sx.Value;
            this.oMasterRow["Cong_Suat"] = this.txtCong_Suat.Value;
            this.oMasterRow["Loai_Ts"] = this.txtLoai_Ts.Value;
            this.oMasterRow["Ma_Nh_Ts"] = this.txtMa_Nh_Ts.Value;
            this.oMasterRow["Ten_Nh_Ts"] = this.txtTen_Nh_Ts.Value;
            this.oMasterRow["Stt_Nh_Ts"] = this.txtMa_Nh_Ts.GetFieldData("Stt_Nh_Ts");
            this.oMasterRow["Ma_MDSD"] = this.txtMa_MDSD.Value;
            this.oMasterRow["Tk"] = this.txtTk.Value;
            this.oMasterRow["Ma_Bp"] = this.txtMa_Bp.Value;
            this.oMasterRow["Ten_Bp"] = this.txtTen_Bp.Value;
            this.oMasterRow["Dien_Giai"] = this.txtDien_Giai.Value;
            this.oMasterRow["Desc_EN"] = this.txtDesc_EN.Value;
            this.oMasterRow["Tinh_KH"] = this.txtTinh_KH.Value;
            this.oMasterRow["Ngay_KH"] = this.txtNgay_KH.Value;
            this.oMasterRow["So_Thang"] = this.txtSo_Thang.Value;
            this.oMasterRow["Tk_Co"] = this.txtTk_Co.Value;
            this.oMasterRow["Tk_No"] = this.txtTk_No.Value;
            this.oMasterRow["Ma_NCC"] = this.txtMa_Ncc.Value;
            this.oMasterRow["Ten_NCC"] = this.txtTen_Ncc.Value;
            this.oMasterRow["Han_BH"] = this.txtHan_Bh.Value;
            this.oMasterRow["Ma_NSX"] = this.txtMa_Nsx.Value;
            this.oMasterRow["Ten_NSX"] = this.txtTen_Nsx.Value;
            this.oMasterRow["Ma_Qg"] = this.txtMa_Qg.Value;
            this.oMasterRow["Ngay_BDKH"] = this.txtNgay_BDKH.Value;
            this.oMasterRow["Ma_Dvt"] = this.txtMa_Dvt.Value;
            this.oMasterRow["Ten_Dvt"] = this.txtTen_Dvt.Value;
            //this.oMasterRow["Ma_Km"] = this.txtMa_Km.Value;
            this.oMasterRow["TTien0"] = this.txtTongNguyenGia.Value;
            this.oMasterRow["TTien1"] = this.txtGiaTriHaoMon.Value;            
            this.oMasterRow["TTien2"] = this.txtKhauHaoThang.Value;
            this.oMasterRow["TTien3"] = this.txtGiaTriConLai.Value;
            this.oMasterRow["Ma_Loai1"] = base.txtMa_Loai1.Value;
            this.oMasterRow["Ma_Loai2"] = base.txtMa_Loai2.Value;
            this.oMasterRow["Ma_Loai3"] = base.txtMa_Loai3.Value;

            if (!this.oMethod.Save(base.NewChecked, this.oMasterRow, this.oDetailTable))
            {
                MessageBox.Show("Mã tài sản đã tồn tại!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (base.NewChecked)
            {
                localCurrentRow = base.LocalTable.NewRow();
                base.LocalTable.Rows.Add(localCurrentRow);
            }
            else
            {
                localCurrentRow = base.LocalCurrentRow;
            }
            foreach (DataColumn column in localCurrentRow.Table.Columns)
            {
                if (this.oMasterRow.Table.Columns.Contains(column.ColumnName))
                {
                    localCurrentRow[column.ColumnName] = this.oMasterRow[column.ColumnName];
                }
            }
            if (this.ib_PictureChanged)
            {
                SSDataAccess.SetPicture(base.LocalFormLister.LocalTableName, base.LocalFormLister.LocalKeyField, this.oMasterRow[base.LocalFormLister.LocalKeyField], "Image_Name", "Image_Item", this.is_PicturePath);
            }
            base.LocalCurrentRow = localCurrentRow;
            base.LocalTable.AcceptChanges();
            this.txtMa_Ts.Focus();
            return base.OnSave();
        }      

        public override void OnShow()
        {
            this.oMasterRow = this.oMethod.GetMasterDataRow(base.LocalCurrentRow["Stt"]);
            this.txtMa_Ts.Value = this.oMasterRow["Ma_Ts"];
            
            this.txtThe_Ts.Value = this.oMasterRow["The_Ts"];
            this.txtSo_Hieu.Value = this.oMasterRow["So_Hieu"];
            this.txtTen_Ts.Value = this.oMasterRow["Ten_Ts"];
            this.txtTen_Ts_E.Value = this.oMasterRow["Ten_Ts_E"];
            //this.txtDvt.Value = this.oMasterRow["Dvt"];
            this.txtSo_Luong.Value = this.oMasterRow["So_Luong"];
            this.txtSo_Ct_T.Value = this.oMasterRow["So_Ct_T"];
            this.txtMa_Ncc.Value = this.oMasterRow["Ma_Ncc"];
            this.txtTen_Ncc.Value = this.oMasterRow["Ten_Ncc"];
            this.txtHan_Bh.Value = this.oMasterRow["Han_Bh"];
            this.txtMa_Nsx.Value = this.oMasterRow["Ma_Nsx"];
            this.txtTen_Nsx.Value = this.oMasterRow["Ten_Nsx"];
            this.txtNuoc_Sx.Value = this.oMasterRow["Nuoc_Sx"];
            this.txtMa_Qg.Value = this.oMasterRow["Ma_Qg"];
            this.txtNam_Sx.Value = this.oMasterRow["Nam_Sx"];
            this.txtCong_Suat.Value = this.oMasterRow["Cong_Suat"];
            this.txtLoai_Ts.Value = this.oMasterRow["Loai_Ts"];
            this.txtMa_Nh_Ts.Value = this.oMasterRow["Ma_Nh_Ts"];
            this.txtTen_Nh_Ts.Value = this.oMasterRow["Ten_Nh_Ts"];
            this.txtMa_MDSD.Value = this.oMasterRow["Ma_MDSD"];
            this.txtTk.Value = this.oMasterRow["Tk"];
            this.txtMa_Bp.Value = this.oMasterRow["Ma_Bp"];
            this.txtTen_Bp.Value = this.oMasterRow["Ten_Bp"];
            this.txtDien_Giai.Value = this.oMasterRow["Dien_Giai"];
            this.txtDesc_EN.Value = this.oMasterRow["Desc_EN"];
            this.txtTinh_KH.Value = this.oMasterRow["Tinh_KH"];
            this.txtTk_Co.Value = this.oMasterRow["Tk_Co"];
            this.txtTk_No.Value = this.oMasterRow["Tk_No"];
            this.txtMa_Dvt.Value = this.oMasterRow["Ma_Dvt"];
            this.txtNgay_BDKH.Value = this.oMasterRow["Ngay_BDKH"];

            //this.txtMa_Sp.Value = this.oMasterRow["Ma_Sp"];
            //this.txtMa_Km.Value = this.oMasterRow["Ma_Km"];
            base.txtMa_Loai1.Value = this.oMasterRow["Ma_Loai1"];
            base.txtMa_Loai2.Value = this.oMasterRow["Ma_Loai2"];
            base.txtMa_Loai2.Value = this.oMasterRow["Ma_Loai2"];
            this.PictureBox.Image = SSDataAccess.GetPicture(base.LocalFormLister.LocalTableName, base.LocalFormLister.LocalKeyField, this.oMasterRow[base.LocalFormLister.LocalKeyField], "Image_Name", "Image_Item");
            base.OnShow();
            SendKeys.Send("{End}");
        }

        private void PictureBox_DoubleClick(object sender, EventArgs e)
        {
            this.ib_PictureChanged = true;
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.InitialDirectory = "";
            dialog.Filter = "JPEG (*.jpg;*.jpeg;*.jpe;*.jfif)|*.jpg;*.jpeg;*.jpe;*.jfif|Bitmap files (*.bmp)|*.bmp|GIF (*.gif)|*.gif|TIFF (*.tif;*.tiff)|*.tif;*.tiff|All files (*.*)|*.*";
            dialog.CheckFileExists = true;
            dialog.ShowDialog();
            this.is_PicturePath = dialog.FileName;
            if (!this.is_PicturePath.Equals(string.Empty))
            {
                this.PictureBox.Image = new Bitmap(this.is_PicturePath);
            }
            else
            {
                this.PictureBox.Image = null;
            }
        }

        private bool Sum()
        {
            DataRow row = ((DataRowView) this.grdDetail.CurrentRow.DataBoundItem).Row;
            row["Tien3"] = ((decimal) row["Tien0"]) - ((decimal) row["Tien1"]);
            row["Tien4"] = (((decimal) row["Tien4"]) == 0M) ? row["Tien0"] : row["Tien4"];
            decimal num = 0M;
            decimal num2 = 0M;
            decimal num3 = 0M;
            decimal num4 = 0M;
            foreach (DataRow row2 in this.oDetailTable.Rows)
            {
                if (row2.RowState != DataRowState.Deleted)
                {
                    if (((string) row2["Loai_TGTS"]) == "T")
                    {
                        num += (decimal) row2["Tien0"];
                        num2 += (decimal) row2["Tien1"];
                        num3 += (decimal) row2["Tien3"];
                        num4 += (decimal) row2["Tien4"];
                    }
                    else
                    {
                        num -= (decimal) row2["Tien0"];
                        num2 -= (decimal) row2["Tien1"];
                        num3 -= (decimal) row2["Tien3"];
                        num4 -= (decimal) row2["Tien4"];
                    }
                }
            }
            this.txtTongNguyenGia.Value = num;
            this.txtGiaTriHaoMon.Value = num2;
            this.txtKhauHaoThang.Value = (this.txtSo_Thang.NumericValue != 0M) ? decimal.Round(num4 / this.txtSo_Thang.NumericValue, AppInstance.LCAmountDecimals) : 0M;
            this.txtGiaTriConLai.Value = num3;
            this.oMasterRow["TTien4"] = num4;
            return true;
        }

        private void txtSo_Thang_Validated(object sender, EventArgs e)
        {
            this.Sum();
        }

        public string FixedAssetType
        {
            get
            {
                return this.is_FixedAssetType;
            }
            set
            {
                this.is_FixedAssetType = value;
                txtLoai_Ts.Value = txtLoai_Ts.Text = value;
            }
        }

        private void FormDmTsEditor_Load(object sender, EventArgs e)
        {

        }

        private void lblTk_Click(object sender, EventArgs e)
        {

        }

        private void txtTk_TextChanged(object sender, EventArgs e)
        {

        }

        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (this.txtMa_Ts.Focused && (keyData == Keys.Enter || keyData == Keys.Tab))
            {
                if (this.txtMa_Ts.Value.ToString().Trim().Length <= AppInstance.Subsidiary.Length)
                {
                    errorProvider.SetError(txtMa_Ts, "Mã phải có ít nhất 5 ký tự");
                    return false;
                }

                if (this.txtMa_Ts.Value.ToString().Trim().Substring(0, 4).Equals(AppInstance.Subsidiary))
                {
                    errorProvider.Clear();
                }
                else
                {
                    errorProvider.SetError(txtMa_Ts, "Mã phải bắt đầu bằng các ký tự: " + AppInstance.Subsidiary);
                    return false;
                }                
                txtThe_Ts.Value = txtMa_Ts.Value;
            }

            if (this.txtTinh_KH.Focused && (keyData == Keys.Enter || keyData == Keys.Tab))
            {
                if (txtTinh_KH.Value.Equals("K"))
                {
                    this.txtNgay_KH.Value = this.txtNgay_Ts.Value;
                    this.txtSo_Thang.Value = "1";
                }
            }

            if (keyData == Keys.F12)
            {
                if (AppInstance.UserName == "ADMIN")
                {
                    ShowImportButtons();
                }
            }
            return base.ProcessCmdKey(ref msg, keyData);
        }


        protected override void ShowImportButtons()
        {
            base.ShowImportButtons();
            foreach (Control control in this.Controls)
            {
                if (control.GetType() == typeof(LabelControl) || control.GetType() == typeof(TextControl)
                    || control.GetType() == typeof(Panel) || control.GetType() == typeof(GridDetail) || control.GetType() == typeof(TextDate)
                    || control.GetType() == typeof(TextSearch)
                    || control.GetType() == typeof(TextOption)
                    || control.GetType() == typeof(TextNumeric))
                {
                    control.Visible = false;
                }
            }
        }

        protected override void DoImport()
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                Thread.Sleep(5000);

                MessageBox.Show("Quá trình kết chuyển dữ liệu thành công!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {

            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
            base.DoImport();
        }
    }
}

